#include <stdio.h>
#define D(s) s=p[e++]-48;while(p[e]!=32&&p[e])s=10*s+p[e++]-48;e++;
#define uint unsigned int
#define MAX 1000
uint A[MAX],B[MAX],X[2],Y[2];


void main()
{
	char p[100];
	uint n,G1,G2,e=0,i,kxz=0,select;
	gets(p);
	D(n);
	for(i=0;i<n;i++)
	{
		gets(p);
		e=0;D(A[i])D(B[i])
	}
	gets(p);
	e=0;D(G1)D(X[0])D(Y[0])
	gets(p);
	e=0;D(G2)D(X[1])D(Y[1])
	if ((int)(X[0]-Y[0])>(int)(X[1]-Y[1]))
	{
		e=X[0];X[0]=X[1];X[1]=e;
		e=Y[0];Y[0]=Y[1];Y[1]=e;
	}
	for(i=0;i<n;i++)
	{
		if (A[i]>B[i])
		{
			if(G1-->0)
				select=1;
			else
				select=0;
		}
		else
		{
			if(G2-->0)
				select=0;
			else
				select=1;
		}
		kxz+=X[select]*A[i]+Y[select]*B[i];
	}
	printf("%d",kxz);
}